package com.test.nnooolwdeaer.bean_wooden.process_wooden;

import com.test.nnooolwdeaer.util_wooden.StringUtil_wooden;
import com.google.gson.Gson;
import com.google.gson.JsonArray;

import java.util.ArrayList;

public class ProcessStep_wooden {

    private ProcessStep_wooden(){}

    private String apiUrl;
    private JsonArray dataList;
    private JsonArray extDataList;
    private String showTopTips;
    private String itemCount;
    private String isContact;
    private String contactParamName;
    private ArrayList<ArrayList<String>> relationShips;


    public String getApiUrl_wooden() {
        return StringUtil_wooden.getSafeString_wooden(apiUrl);
    }

    public boolean showTopTips_wooden(){
        return StringUtil_wooden.getSafeString_wooden(showTopTips).equalsIgnoreCase("YES");
    }

    public int getDataListSize_wooden(){
        if (dataList==null) return 0;
        return dataList.size();
    }

    public ProcessData_wooden getProcessData_wooden(int index){
        if (index<0||index>=dataList.size()) return null;
        return new Gson().fromJson(dataList.get(index).toString(), ProcessData_wooden.class);
    }

    public int getExtDataListSize_wooden(){
        if (extDataList == null) return 0;
        return extDataList.size();
    }

    public ProcessData_wooden getExtProcessData_wooden(int index){
        if (index<0||index>=extDataList.size()) return null;
        return new Gson().fromJson(extDataList.get(index).toString(), ProcessData_wooden.class);
    }

    public int getItemCount_wooden() {
        return StringUtil_wooden.safeParseInt_wooden(itemCount);
    }

    public boolean isContact_wooden() {
        return StringUtil_wooden.getSafeString_wooden(isContact).equalsIgnoreCase("YES");
    }

    public String getContactParamName_wooden() {
        return StringUtil_wooden.getSafeString_wooden(contactParamName);
    }

    public ArrayList<String> getRelationShips_wooden(int index) {
        if (relationShips==null||relationShips.size()<=index) return new ArrayList<>();
        return relationShips.get(index);
    }

}
